<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
    <div id="app"></div>
</body>
<script>
    app = Vue.createApp({
        data(){
            return{
                list:['红','橙','黄']
            }
        },
        methods:{
            onclick(){
                this.list.push('绿');
            }
        },
       
        template:`
        <ul>
            <template
                v-for="(item,index) in list"
                :key="index+item"
            >
            <li v-if="item != '红'">
                [{{index}}]{{item}}
            </li>
            </template>
        </ul>`
    })
    const vm = app.mount("#app")
</script>
</html>